package com.geek.javase.ch18.videodemo.pattern.proxy.jdk;


import java.util.concurrent.TimeUnit;

/*
 *@Date 2025/11/6
 *@Author wangpeng
 *@Description TODO
 */
//目标对象 target
public class BankService implements IService {
    //登录
    public void login(Long id,String pwd){
        try {
            TimeUnit.SECONDS.sleep(1);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        if(id.equals(1L) && pwd.equals("123")){
            System.out.println("登录成功!");
            return;
        }
        System.out.println("登录失败！");
    }
    //注册
    public void register(Long id,String  name,String pwd){
        try {
            TimeUnit.SECONDS.sleep(1);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println("注册成功:id:"+id+",name:"+name+",pwd:"+pwd);
    }
}
